﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShopEdit.aspx.cs" Inherits="TimKen.Web.Shop.ShopEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../Common/Script/jquery-1.7.2/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../Common/autocomplete/ShowDiv.js" type="text/javascript"></script>
    <script src="../Common/Script/common.js" type="text/javascript"></script>
    <link href="../Common/Style/selectCity.css" rel="stylesheet" type="text/css" />
    <link href="../Common/Style/reset.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function BindAutoCom() {
            var _obj = null;
            $.ajax({
                // 要用post方式   
                type: "POST",
                //方法所在页面和方法名   
                url: "ShopEdit.aspx/getJsonHotel",
                data: "{'id':'" + $("#ProCode").val() + "'}", //没有参数的初始化
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                complete: function () {
                    $("#ProCode").showComponent({ pageSize: 7, selectId: 'cityListId', mapFlag: 0, obj: _obj });
                },
                success: function (data) {
                    $("#cityListId").find(".popSelect").html("");
                    var _html = '<dt>按产品唯一编号查找</dt>';
                    if (data != null && data.d != "") {
                        var da = eval("(" + data.d + ")");
                        for (var i = 0; i < da.length; i++) {
                            _html += '<dd><span>' + da[i].ItemCode + '</span></dd>'
                        }
                        _obj = da;
                    }

                    $("#cityListId").find(".popSelect").html(_html).show();
                },
                error: function (err) {
                    alert(err);
                }
            });
        }
        $(function () {
         $("#ProCode").bind("keyup", BindAutoCom)
     });
     function CloseBox() {
         window.parent.Hide();
         window.parent.location = "ShopProJect.aspx";
     }
     function SetMoenyByNum() {
         var num = $("#Num").val();
         var nm = num == "" ? 0 : parseInt(num.replace(/(^\s*)|(\s*$)/g, ""));
         var pri = $("#Dprice").val();
         $("#Money").val(num * pri);
     }

     function IsSubMit() {
         var ProCode = $("#ProCode").val();
         var num = $("#Num").val();
         var date = $("#Date").val();
            var bo=false;
            if(ProCode=="")
            {
            bo=false;
            alert("产品编号不能为空!");
            }else{
            bo=true;
            }
        if (/^[0-9]+/.test(num)) {
            bo=true;
            }else{
            bo=false;
            alert("数量必须是数字类型!");
            }
            if(/^\d{4}-\d{2}-\d{2}$/.test(date))
            {
            bo=true;
            }else{
            bo=false;
            alert("时间格式必须是yyyy-MM-dd类型!");
            }
         return bo;
     }
      
     function CloseParent() {
         window.parent.Hide();
     }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="padding-left:40px;">
    	<table width="100%" border="0" cellspacing="0" cellpadding="2" class="smhtable">
              <tr>
                <th>产品编号：</th>
                <td>
                  <input type="text"  runat="server" id="ProCode"   /></td>
                  <input type="hidden" id="txtShowDiv" runat="server" class="txtShowDiv" style="width: 144px"  />
                  <div id="cityListId" class="m_tagsItem" >
                    <dl class="popSelect" >
                    </dl>
                    <p class="pagenum" style=" display:none;">
                    </p>
                </div>
              </tr>
              <tr>
                <th>产品型号：</th>
                <td><input type="text" id="ProLx" runat="server" readonly="true" style=" border:none"  ></td>
              </tr>
              <tr>
                <th>数量：</th>
                <td><input type="text" id="Num" runat="server" onkeydown="return testKeyEven(event);" onkeyup="SetMoenyByNum();" /></td>
              </tr>
              <tr>
                <th>单价：</th>
                <td><input type="text" id="Dprice" runat="server" readonly="true" style=" border:none" /></td>
              </tr>
              <tr>
                <th>金额：</th>
                <td><input type="text"  id="Money" runat="server" readonly="true" style=" border:none" /></td>
              </tr>
              <tr>
                <th>净重：</th>
                <td><input type="text" readonly="true"  runat="server" id="jz" style=" border:none" /></td>
              </tr>
              <tr>
                <th>最新倍数：</th>
                <td><input type="text" id="NewBs" runat="server" readonly="true"  style=" border:none" /></td>
              </tr>
              <tr>
                <th>最小定量：</th>
                <td><input type="text" id="MinDl" runat="server" readonly="true" style=" border:none"  /></td>
              </tr>
              <tr>
                <th>要求日期：</th>
                <td><input type="text" id="Date" runat="server" class="Wdate" onclick="WdatePicker()" />
                    <asp:HiddenField ID="Hd_sl" runat="server" />
                </td>

              </tr>
           
            </table>

    <p style=" text-align:center;padding-top:10px;">
        <asp:ImageButton ID="Img_But" runat="server" 
            ImageUrl="../Common/Image/iconbtnbg/savebtn.gif" onclick="Img_But_Click"  OnClientClick="return IsSubMit();"/>
     <a><img src="../Common/Image/iconbtnbg/canclebtn.gif"  onclick="CloseParent()"/></a></p>
    </div>
    </form>
</body>
</html>
